package com.view.appkudos;

import android.app.Activity;
import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.view.View;
import android.widget.TabHost;
import android.widget.TextView;

public class AppKudos extends TabActivity implements TabHost.TabContentFactory {
    /** Called when the activity is first created. */
    /*@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, UserProfileActivity.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("profile").setIndicator("Profile",
                          res.getDrawable(R.drawable.ic_profile))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Do the same for the other tabs
        intent = new Intent().setClass(this, UserAppsActivity.class);
        spec = tabHost.newTabSpec("apps").setIndicator("Apps",
                          res.getDrawable(R.drawable.ic_apps))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, UserConnectionsActivity.class);
        spec = tabHost.newTabSpec("connections").setIndicator("Connections",
                          res.getDrawable(R.drawable.ic_connections))
                      .setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(2);
    }*/

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final TabHost tabHost = getTabHost();
        Intent intent;  // Reusable Intent for each tab
        
        intent = new Intent().setClass(this, UserProfileActivity.class);
        tabHost.addTab(tabHost.newTabSpec("profile")
                .setIndicator("Profile", getResources().getDrawable(R.drawable.ic_profile))
                .setContent(this));
        tabHost.addTab(tabHost.newTabSpec("apps")
                .setIndicator("Apps", getResources().getDrawable(R.drawable.ic_profile))
                .setContent(this));
        tabHost.addTab(tabHost.newTabSpec("connections")
                .setIndicator("Connections", getResources().getDrawable(R.drawable.ic_profile))
                .setContent(this));
        tabHost.setCurrentTab(0);
    }

    /** {@inheritDoc} */
    public View createTabContent(String tag) {
        final TextView tv = new TextView(this);
        tv.setText("Content for tab with tag " + tag);
        return tv;
    }
}